﻿using Kernelx.Contexts.Core;



#if NETSTANDARD2_0  
using Microsoft.Extensions.DependencyInjection;
#endif

#if NET35
using Kernelx.Common.DependencyInjection;

#endif

namespace Kernelx.Contexts.Configuration
{
    /// <summary>
    /// 
    /// </summary>
    public abstract class WorkloadContextOptions
    {

        /// <summary>
        ///预定义当前用户的默认缺省实例
        /// </summary>
        public ICurrentUser DefaultCurrentUser { get; set; } = new DefaultCurrentUser("-1", "unknown", false);

        /// <summary>
        /// 
        /// </summary>
        protected WorkloadContextOptions() => WorkloadStartupContext.Configure(this);

        /// <summary>
        /// 
        /// </summary>
        public abstract IServiceCollection Services { get; protected set; }

        /// <summary>
        ///访问 <see cref="WorkloadStartupContext.Current"/> 时,会触发执行此方法生成当前上下文实例
        /// </summary>
        /// <returns></returns>
        internal protected abstract IWorkloadStartupContext Generate();
    }
}
